package com.kly.user.enums;

import java.util.Objects;

/**
 * type: 0-发送通知到userCode， 1-发送通知到userCode的会话列表中的用户
 * @author linqu
 */
public enum PushNotificationType {

    PUSH_TO_SELF(0, "PUSH_TO_SELF", "本应用消息通知"),

    PUSH_TO_CHAT_LIST(1, "PUSH_TO_CHAT_LIST", "发送通知到userCode的会话列表中的用户"),
    ;

    private final int type;

    private final String Value;

    private final String description;


    PushNotificationType(int type, String value, String description) {
        this.type = type;
        Value = value;
        this.description = description;
    }

    public int getType() {
        return type;
    }

    public String getValue() {
        return Value;
    }

    public String getDescription() {
        return description;
    }


    public static PushNotificationType fromType(Integer type) {
        if (Objects.isNull(type)) {
            return null;
        }
        for (PushNotificationType userStatus : values()) {
            if (userStatus.getType() == type) {
                return userStatus;
            }
        }
        return null;
    }
}
